<?php
//No direct access
defined('_JEXEC') or die('Restricted access');
?>
<div id="ownservices">
<div id="mainmenuownservice"><?php echo MenuHelper::nav(); ?></div>
<div id="mainownservice">
<h3>
	<?php 
		if($this->row->id) { 
			echo JText::_('OWNSERVICE_EDIT_ACCOUNT'); 
		} else { 
			echo JText::_('OWNSERVICE_NEW_ACCOUNT'); 
		} 
	?>
</h3>
<hr />
<?php $row = $this->row; ?>
<script language="javascript" type="text/javascript">
	<!--
		function submitbutton(pressbutton)
		{
			var form = document.adminForm;
			if (pressbutton == 'account' || pressbutton == 'detail') {
				submitform( pressbutton );
				return;
			}
			if (form.account_name.value == ""){
				alert( "<?php echo JText::_( 'OWNSERVICE_PLEASE_INPUT_ACCOUNT_NAME', true ); ?>" );
			} else if (form.account_no.value == ""){
				alert( "<?php echo JText::_( 'OWNSERVICE_PLEASE_INPUT_ACCOUNT_NO', true ); ?>" );
 			} else if (form.account_type.value == ""){
 				alert( "<?php echo JText::_( 'OWNSERVICE_PLEASE_SELECT_ACCOUNT_TYPE', true ); ?>" );
			} else if (form.bank_name.value == ""){
				alert( "<?php echo JText::_( 'OWNSERVICE_PLEASE_INPUT_BANK_NAME', true ); ?>" );
			} else if (form.address.value == ""){
				alert( "<?php echo JText::_( 'OWNSERVICE_PLEASE_INPUT_ADDRESS', true ); ?>" );
			} else if (form.city.value == ""){
				alert( "<?php echo JText::_( 'OWNSERVICE_PLEASE_INPUT_CITY', true ); ?>" );
			} else if (form.state.value == ""){
				alert( "<?php echo JText::_( 'OWNSERVICE_PLEASE_INPUT_STATE', true ); ?>" );
			} else if (form.postcode.value == ""){
				alert( "<?php echo JText::_( 'OWNSERVICE_PLEASE_INPUT_POSTCODE', true ); ?>" );
			} else if (form.country.value == ""){
				alert( "<?php echo JText::_( 'OWNSERVICE_PLEASE_INPUT_COUNTRY', true ); ?>" );
			} else {
				submitform( pressbutton );
			}
		}

	//-->
</script>
<div class="cSubmenu">
	<ul class="submenu">
		<li><a href="#" onclick="javascript: submitbutton('detail')"><?php echo JText::_('OWNSERVICE_PERSONAL_DETAIL'); ?></a></li>
		<li><a href="#" onclick="javascript: submitbutton('account')" class="active"><?php echo JText::_('OWNSERVICE_ACCOUNTS'); ?></a></li>
		<li><a href="#" onclick="javascript: submitbutton('transfer')"><?php echo JText::_('OWNSERVICE_TRANSFER_HISTORYS'); ?></a></li>
	</ul>
</div>
<form action="<?php echo JRoute::_('index.php?option=com_ownservice'); ?>" method="post" name="adminForm">
	<table class="admintable">
		<tr>
			<td class="key"><?php echo JText::_('OWNSERVICE_ACCOUNT_NAME'); ?> <span class="red">*</span></td>
			<td><input type="text" name="account_name" value="<?php echo $row->account_name ?>" class="inputbox" style="width: 250px;" /></td>
		</tr>
		<tr>
			<td class="key"><?php echo JText::_('OWNSERVICE_ACCOUNT_NO'); ?> <span class="red">*</span></td>
			<td>
				<input type="text" name="account_no" id="account_no" value="<?php echo $row->account_no ?>" class="inputbox" style="width: 250px;" />
				<span id="shownum"></span>
			</td>
		</tr>
		<tr>
			<td class="key"><?php echo JText::_('OWNSERVICE_ACCOUNT_TYPE'); ?> <span class="red">*</span></td>
			<td><?php echo $this->lists['type']; ?></td>
		</tr>
		<tr>
			<td></td>
			<td>
				<div id="typeother" <?php if($row->type_other == ''): ?>style="display:none;"<?php endif; ?>>
					<input type="text" name="type_other" value="<?php echo $row->type_other; ?>" class="inputbox" style="width: 250px;" />
				</div>
			</td>
		</tr>
		<tr>
			<td class="key"><?php echo JText::_('OWNSERVICE_BANK_NAME'); ?> <span class="red">*</span></td>
			<td>
				<?php echo $this->lists['bank']; ?>
			</td>
		</tr>
		<tr>
			<td></td>
			<td>
				<div id="bankother" <?php if($row->bank_other == ''): ?>style="display:none;"<?php endif; ?>>
					<input type="text" name="bank_other" value="<?php echo $row->bank_other; ?>" style="width: 250px;" class="inputbox" />
				</div>
			</td>
		</tr>
		<tr>
			<td class="key"><?php echo JText::_('OWNSERVICE_BRANCH_NAME'); ?></td>
			<td><input type="text" name="branch_name" value="<?php echo $row->branch_name ?>" class="inputbox" style="width: 250px;" /></td>
		</tr>
		<tr>
			<td class="key"><?php echo JText::_('OWNSERVICE_BRANCH_CITY'); ?></td>
			<td><input type="text" name="branch_city" value="<?php echo $row->branch_city ?>" class="inputbox" style="width: 250px;" /></td>
		</tr>
		<tr>
			<td class="key"><?php echo JText::_('OWNSERVICE_ADDRESS'); ?> <span class="red">*</span></td>
			<td><textarea style="width:250px;" rows="3" name="address" class="inputbox"><?php echo $row->address; ?></textarea></td>
		</tr>
		<tr>
			<td class="key"><?php echo JText::_('OWNSERVICE_CITY'); ?> <span class="red">*</span></td>
			<td><input type="text" name="city" value="<?php echo $row->city ?>" class="inputbox" style="width: 250px;" /></td>
		</tr>
		<tr>
			<td class="key"><?php echo JText::_('OWNSERVICE_STATE'); ?> <span class="red">*</span></td>
			<td><input type="text" name="state" value="<?php echo $row->state ?>" class="inputbox" style="width: 250px;" /></td>
		</tr>
		<tr>
			<td class="key"><?php echo JText::_('OWNSERVICE_POSTCODE'); ?> <span class="red">*</span></td>
			<td><input type="text" name="postcode" value="<?php echo $row->postcode ?>" class="inputbox" style="width: 250px;" /></td>
		</tr>
		<tr>
			<td class="key"><?php echo JText::_('OWNSERVICE_COUNTRY'); ?> <span class="red">*</span></td>
			<td><?php echo $this->lists['country']; ?></td>
		</tr>
		<tr>
			<td class="key"><?php echo JText::_('OWNSERVICE_BIRTHDAY'); ?> </td>
			<td>
				<?php echo JHTML::_('calendar', $row->birthday, 'birthday', 'birthday', '%Y-%m-%d',array('class'=>'inputbox')); ?>
			</td>
		</tr>
		<tr>
			<td class="key"><?php echo JText::_('OWNSERVICE_PHONE'); ?></td>
			<td><input type="text" name="phone_no" value="<?php echo $row->phone_no; ?>" class="inputbox" style="width: 250px;" /></td>
		</tr>
		<tr>
			<td class="key"><?php echo JText::_('OWNSERVICE_EMAIL'); ?></td>
			<td><input type="text" name="email" value="<?php echo $row->email; ?>" class="inputbox" style="width: 250px;" /></td>
		</tr>
		<tr>
			<td colspan="2" align="center"><hr /></td>
		</tr>
		<tr>
			<td colspan="2" align="center">
			<input type="button" id="save" name="save" value="<?php echo JText::_('OWNSERVICE_SAVE'); ?>" onClick="javascript: submitbutton('acsave')" />
			<input type="button" name="cancel" value="<?php echo JText::_('OWNSERVICE_CANCEL'); ?>" onClick="javascript: submitbutton('account')" />
			</td>
		</tr>
	</table>
	<input type="hidden" name="id" value="<?php echo $row->id; ?>" />
	<input type="hidden" name="mid" value="<?php echo $this->member->id; ?>" />
	<input type="hidden" name="user_id" value="<?php echo $this->member->user_id; ?>" />
	<input type="hidden" name="option" value="com_ownservice" />
	<input type="hidden" name="task" value="acsave" />
	<input type="hidden" name="Itemid" value="<?php echo JRequest::getVar('Itemid'); ?>" />
	<input type="hidden" name="controller" value="member" />
	<input type="hidden" name="view" value="member" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
</div>
</div>